package ogon.spinner;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;

public class SpinnerBase extends Activity implements AdapterView.OnItemSelectedListener{
    /** Called when the activity is first created. */
	TextView selection;
	String[] items = {"test","prueba","bravo","jungle","welcome"};
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        selection=(TextView)findViewById(R.id.selection);
        Spinner spinner = (Spinner)findViewById(R.id.spinnerSelector);
        spinner.setOnItemSelectedListener(this);
        ArrayAdapter<String> aa  = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,items);
        aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(aa);
    }
    public void onItemSelected(AdapterView<?> parent,View v, int position, long id){
    	selection.setText(items[position]);
    }
    public void onNothingSelected(AdapterView<?> parent) {
    	selection.setText("");
    }
}